home *** CD-ROM | disk | FTP | other *** search
- Unit Init_Libs;
-
- INTERFACE
-
- Uses
-
- Exec , Graphics , Intuition , Gadtools , Asl , Utility , Amiga ;
-
-
- IMPLEMENTATION
-
- const
-
- DELAY_REQ = 2000;
- LIB_VER = 36;
-
- var
-
- OldExitProc : Pointer;
-
- (***************************************************************************)
- (* << UTILITY FUNCTION >> *)
- (***************************************************************************)
-
- Procedure Error( s :string );
- begin
- writeln(s);
- Delay( DELAY_REQ );
- halt
- end;
-
- Procedure InitPointerLibs;
- begin
- GadToolsBase := NIL ;
- AslBase := NIL ;
- GfxBase := NIL ;
- IntuitionBase := NIL ;
- UtilityBase := NIL ;
- end;
-
- (***************************************************************************)
- (* << FUNCTION >> *)
- (***************************************************************************)
-
- Procedure InitFunction;
- begin
- IntuitionBase := pIntuitionBase( OpenLibrary( 'intuition.library',LIB_VER ) );
- if IntuitionBase = NIL then Error( 'intuition.library ');
-
- GfxBase := pGfxBase( OpenLibrary( 'graphics.library',LIB_VER ) );
- if GfxBase = NIL then Error( 'graphics.library');
-
- AslBase := OpenLibrary( 'asl.library',LIB_VER );
- if AslBase = NIL then Error( 'asl.library ');
-
- GadToolsBase := OpenLibrary( 'gadtools.library',LIB_VER );
- if GadToolsBase = NIL then Error( 'gadtools.library ');
-
- UtilityBase := pUtilityBase( OpenLibrary( 'utility.library' , LIB_VER ));
- if UtilityBase = NIL then Error( 'utility.library ' );
- end;
-
- Procedure ExitFunction;
- begin
- if GadToolsBase <> NIL then CloseLibrary( GadToolsBase );
-
- if AslBase <> NIL then CloseLibrary( AslBase );
-
- if GfxBase <> NIL then CloseLibrary( pLibrary( GfxBase ) );
-
- if IntuitionBase <> NIL then CloseLibrary( pLibrary( IntuitionBase ) );
-
- if UtilityBase <> NIL then CloseLibrary( pLibrary( UtilityBase ) );
- end;
-
- (***************************************************************************)
- (* << INIT AND EXIT PROCEDURE >> *)
- (***************************************************************************)
-
- Procedure ExitHandler;
- begin
- ExitProc := OldExitProc;
- ExitFunction;
- end;
-
- Procedure Initialize;
- begin
- OldExitProc := ExitProc;
- ExitProc := @ExitHandler;
- InitFunction;
- end;
-
- BEGIN
- Initialize;
- END.